// 寄生组合继承

function Super(name) {
    this.name = name
    this.colors = ['green', 'red', 'blue']
}

Super.prototype.say = function() {
    console.log(this.name);
}

// Sub.prototype = new Super()
// Sub.prototype.constructor = Sub


function Sub(name, age) {
    this.age = age
    Super.call(this, name) // 传参
}

var another = Object.create(Super.prototype)
another.constructor = Sub
Sub.prototype = another

var instance = new Sub('123', 18)
instance.say()

// 构造函数少调用